<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link rel="stylesheet" type="text/css" href="/static/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/login.css" />
</head>

<body>
    <div class="pos">
        <div class="login">
            <span class="close iconfont icon-close"></span>
            <img src="/static/img/login/loginlogo.png" alt="">
            <ul>
                <li></li>
                <li class="phone">登陆</li>
                <li></li>
            </ul>
           
                <input style="margin-top: 0;" type="text" class="tel" id="username" placeholder="请输入您的用户名">
                <input type="password" class="pass" id="password" placeholder="请输入密码">
                <span class="tips"></span>
                <button class="loginbtn">
                    登陆
                </button>
            <p>
                <span>
                    还没有账号?
                    <a href="javascript:;">点击注册</a>
                </span>
            </p>
        </div>
    </div>
    <script src="../public/javascripts/jquery.min.js"></script>
    <script>
        // 点击登录按钮 将用户名和密码传到使用ajax传到后端 
        $('.loginbtn').click(function(){
            // 获取用户名密码
            let username = $('.tel').val()
            let password = $('.pass').val()
            // 使用ajax发送post请求
            $.ajax({
                // 请求方式
                method: 'post',
                // 请求路径
                url: '/login',
                // 参数
                data: {
                    username,
                    password
                },
                // 成功的回调
                success(res) {
                    $('.tips').html(res)
                }
            })


        })
    </script>
</body>
</html>